import 'package:geolocator/geolocator.dart';
import 'package:latlong2/latlong.dart';
///运动轨迹
class Locus {
  ///轨迹点集合
  final List<LatLng> _paths = [];

  ///开始地点
  LatLng? startLatLng() {
    if(_paths.isEmpty) {
      return null;
    }
    return _paths.first;
  }

  ///结束地点
  LatLng? endLatLng() {
    if(_paths.isEmpty) {
      return null;
    }
    return _paths.last;
  }

  void addPosition(Position position) {
    _paths.add(LatLng(position.latitude, position.longitude));
  }

  List<LatLng> get paths => _paths;

}